import {
	mapGetters,
	mapState
} from 'vuex'
import Cache from '@/utils/cache'
export default {
	data() {},
	methods: {

	},
	computed: {
		...mapGetters(['isLogin', 'themeName', 'themeColor', 'userInfo', 'appConfig']),
	},
	// 全局配置分享
	onShareAppMessage() {
		const {
			share_image,
			share_intro,
			share_title
		} = this.appConfig
		const {
			code
		} = this.userInfo

		const share = {
			title: share_title,
			path: `/pages/index/index?invite_code=${code}`,
			imageUrl: share_image
		}

		if (Cache.get('clsp_id')) {

			const {
				avatar
			} = Cache.get('clspInfo')

			share.imageUrl = avatar
			share.path += `&clspId=${Cache.get('clsp_id')}`
		}

		console.log('share', share)

		return share
	},
	onShareTimeline() {
		const {
			share_image,
			share_intro,
			share_title
		} = this.appConfig
		const {
			code
		} = this.userInfo

		const share = {
			title: share_title,
			imageUrl: share_image
		}

		if (Cache.get('clsp_id')) {

			const {
				avatar
			} = Cache.get('clspInfo')

			share.imageUrl = avatar
			share.query = `clspId=${Cache.get('clsp_id')}`
		}

		return share
	}
};